from pydantic import BaseModel, Field
from datetime import datetime
from typing import List, Optional


class SystemPromptCreateRequest(BaseModel):
    title: Optional[str] = Field(None, description="提示词名称")
    content: str = Field(..., description="提示词内容", min_length=1)
    enable_context: Optional[bool] = Field(False, description="是否启用上下文占位符（RAG）")
    context_placeholder: Optional[str] = Field('[CONTEXT]', description="上下文插入占位符，如 [CONTEXT]")


class SystemPromptUpdateRequest(BaseModel):
    title: Optional[str] = Field(None, description="提示词名称")
    content: Optional[str] = Field(None, description="提示词内容")
    enable_context: Optional[bool] = Field(None, description="是否启用上下文占位符（RAG）")
    context_placeholder: Optional[str] = Field(None, description="上下文插入占位符")


class SystemPromptResponse(BaseModel):
    system_prompt_id: int
    title: Optional[str] = None
    content: str
    enable_context: bool
    context_placeholder: Optional[str]
    created_time: datetime
    updated_time: datetime


class SystemPromptListResponse(BaseModel):
    success: bool
    prompts: List[SystemPromptResponse]
    total_count: int
    page: int
    page_size: int
    total_pages: int


class DeleteResponse(BaseModel):
    success: bool
    message: str


